//初始化树
$('#tt').tree({
    method: 'get',
    url: 'http://localhost:3000/classify/list',
    onClick(node) {
        console.log(node._id)
        $('#parentId').val(node._id)//获取当前Pid
    }
});
//初始化表单
$('#dg').datagrid({
toolbar: '#tb',
pagination: true,
fit: true,
url: 'http://localhost:3000/users/list',
columns: [[
    { field: 'ck', checkbox: true },
    { field: '_id', title: 'ID', width: 100 },
    { field: 'name', title: '名称', width: 100 },
    { field: 'phone', title: '手机号', width: 100,
    styler: function(value,row,index){
    
            return 'background-color:#fbf7f7;color:#f36c6c;';
            // the function can return predefined css class and inline style
            // return {class:'c1',style:'color:red'}
        
    }
            },
    { field: 'email', title: '邮箱', width: 100 },
    {
        field: 'operate', title: '操作', width: 100,
        //
        formatter: function (value, row, index) {
            return "<a href='javascript:void(0)' onclick='updata(" + index + ")'>Edit</a> <a href='javascript:void(0)' onclick='removeSelf(this)'>delete</a>"
        }
    }
]],
onDblClickRow(index, row) {
    editData(row);
}
});